package com.example;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: bjc
 * Date: 2025-07-06
 * Time: 14:08
 */
@RestController
@RequestMapping("/log")
public class LoggerController {

//    private static Logger logger = LoggerFactory.getLogger(LoggerController.class);
    private static Logger logger = LoggerFactory.getLogger("LoggerController");
    @RequestMapping("/print")
    public String print(){
        logger.info("使用日志框架进行打印日志");
        return "打印日志";
    }
    @RequestMapping("/print2")
    public String print2(){
        logger.trace("==============trace================");
        logger.debug("==============debug================");
        logger.info("==============info================");
        logger.warn("==============warn================");
        logger.error("==============error================");

        return "打印不同级别的日志";
    }
}
